/**
 * 匿名内部类
 *
 * @author zhu
 * @date 2024-04-09
 */
public class MainTest02 {
    public static void main(String[] args) {
        Fun add = new Fun() {
            @Override
            public int count(int a, int b) {
                return a + b;
            }
        };
        Fun sub = new Fun() {
            @Override
            public int count(int a, int b) {
                return a - b;
            }
        };
        Fun mul = new Fun() {
            @Override
            public int count(int a, int b) {
                return a * b;
            }
        };
        Fun div = new Fun() {
            @Override
            public int count(int a, int b) {
                return a / b;
            }
        };
        System.out.println("两数之和：" + add.count(4,2));
        System.out.println("两数之差：" + sub.count(4,2));
        System.out.println("两数之积：" + mul.count(4,2));
        System.out.println("两数之商：" + div.count(4,2));
    }
}
